import { Button, Form, Input, Select, DatePicker } from 'antd';
import React from 'react';
// import dayjs from 'dayjs';
const { RangePicker } = DatePicker;
function SearchForm({ onSearch }) {
    const onFinish = (value) => {
        onSearch({
            job: value.job,
            name: value.name,
            status: value.status,
            start_time: value.time
                ? value.time[0].format('YYYY-MM-DD')
                : undefined,
            end_time: value.time
                ? value.time[1].format('YYYY-MM-DD')
                : undefined,
        });
    };
    const onReset = () => {
        onSearch({
            job: '',
            name: '',
            status: '',
            end_time: '',
            start_time: '',
        });
    };
    return (
        <div>
            <Form onFinish={onFinish} onReset={onReset} layout="inline">
                <Form.Item name="name" style={{ width: 200 }}>
                    <Input placeholder="请输入姓名" />
                </Form.Item>
                <Form.Item name="job" style={{ width: 200 }} label="岗位">
                    <Select>
                        <Select.Option value="销售员"></Select.Option>
                        <Select.Option value="销售助理"></Select.Option>
                        <Select.Option value="总经理"></Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item name="status" style={{ width: 200 }} label="状态">
                    <Select>
                        <Select.Option value="1"></Select.Option>
                        <Select.Option value="0"></Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item name="time">
                    <RangePicker />
                </Form.Item>
                <Form.Item>
                    <Button htmlType="submit">查询</Button>
                    <Button htmlType="reset">重置</Button>
                </Form.Item>
            </Form>
        </div>
    );
}

export default React.memo(SearchForm);
